<?PHP
	require 'config.php';
	require 'modifyImage.php';
	require 'CyrillicEncoder.php';
	
	//connecting to DB
	$vLink = mysql_connect($DBServer, $DBUser, $DBPassword);
	if(!$vLink) 
		die(mysql_error());
	
	//setting session encoding
	mysql_select_db($DBName, $vLink);	
	mysql_query("SET NAMES 'cp1251';", $vLink);
	mysql_query("SET CHARACTER SET 'cp1251';", $vLink);
	mysql_query("SET SESSION collation_connection = 'cp1251_general_ci';", $vLink);
	
	//retrieving params
	$vID = intval($_GET['id']);
	//$vName = htmlentities($_GET['name'], ENT_QUOTES, "UTF-8");
	$vName = htmlspecialchars($_GET['name'], ENT_QUOTES);
	$vTotal = intval($_GET['total']);
	$vRooms = intval($_GET['rooms']);
	$vVnomere = htmlspecialchars($_GET['vnomere'], ENT_QUOTES);
	$vAbout = htmlspecialchars($_GET['about'], ENT_QUOTES);
	
	//sending query
	$vQuery = 'UPDATE dikar2011_nomer SET';
	$vQuery .= getParam('name', $vName).',';
	$vQuery .= getParam('total', $vTotal).',';
	$vQuery .= getParam('rooms', $vRooms).',';
	$vQuery .= getParam('vnomere', $vVnomere).',';
	$vQuery .= getParam('about', $vAbout);
	$vQuery .= ' WHERE id="' . $vID . '"';
	mysql_query($vQuery);
	mysql_close($vLink);	
	
	function getParam($AName, $AParam)
	{
		return ' ' . $AName . '="' . $AParam .'"';
	}
	//printing update result for AS side
	echo $vQuery;
?>